package com.example.scheduled;

import com.alibaba.fastjson.JSONObject;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.aliyun.openservices.shade.org.apache.commons.lang3.time.DateUtils;
import com.example.util.DateUtil;
import com.example.util.ImageBuilderUtils;
import java.io.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalField;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @program: demo
 * @description: schedule  demo类
 * @author: Mr.Wang
 * @create: 2019-03-27 13:37
 **/
public class PrintTask11 {
    public static void main(String[] args) {


        for (int i = 0; i < 130; i++) {

        System.out.println();
        }


    }

    private static Boolean testFor(List<Integer> list,List<Integer> list1){
        for(Integer str:list){
            Boolean flag = false;
            /*for(Integer str1:list1){
                if(4==str1){
                    flag = true;
                    break;
                }
            }*/
            System.out.println("aa:{}"+flag+",str:"+str);
            return flag;
        }

        return null;
    }

    private static void localtime() {
        LocalDate date =  LocalDate.now();
        Month month = date.getMonth();
        LocalDate date2 = date.plusDays(1L).minusDays(1L);
        LocalDate date1 = date.plusYears(3L).minusDays(1L);
        /*txtFields.put("year", now.get(Calendar.YEAR));
        txtFields.put("month", month);
        txtFields.put("day", now.get(Calendar.DAY_OF_MONTH));*/
        System.out.println(date.toString());
        System.out.println(date2.toString());
        System.out.println(date1.toString());
    }

    private static void testImg() {
        try {
            File file = new File("D:/qr.png");
            File file1 = new File("D:/22.png");
            File file2 = new File("D:/cc.jpg");
            InputStream inputStream = new FileInputStream(file);
            InputStream bg = new FileInputStream(file1);
            InputStream cc = new FileInputStream(file2);
            String saveImgUrl = ImageBuilderUtils.ImageBuilder(inputStream, cc, bg);
        } catch (Exception e) {
            System.out.println("异常");
        }
    }

    private static void test1() throws InterruptedException {
        List<Sku> skus = new ArrayList<>();
        skus.add(new Sku("223", "223", 3L));
        skus.add(new Sku("225", "223", 3L));
        skus.add(new Sku("224", "223", 3L));

        ExecutorService executorService = Executors.newFixedThreadPool(4);
        for (Sku report : skus) {
            try {
                executorService.execute(
                        new Runnable() {
                            @Override
                            public void run() {
                                if ("225".equals(report.getSkuCode()))
                                    skus.add(new Sku("227", "223", 3L));
                            }
                        });
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        executorService.shutdown();


        Thread.sleep(4000L);

        System.out.println(skus.size());
    }

    public static void inputstreamtofile(InputStream ins, File file) throws Exception {
        OutputStream os = new FileOutputStream(file);
        int bytesRead = 0;
        byte[] buffer = new byte[8192];
        while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
            os.write(buffer, 0, bytesRead);
        }
        os.close();
        ins.close();
    }
}
